//
//  WCNNavigationController.m
//  WCN
//
//  Created by 杨鑫 on 15/5/29.
//  Copyright (c) 2015年 ShanghaiCize Trade And Business Co., Ltd. All rights reserved.
//

#import "WCNNavigationController.h"
#import "WCNTabBarVC.h"
#import "WCNCreateMeetingVC.h"
#import "WCNHospitalListVC.h"
@interface WCNNavigationController () <UIGestureRecognizerDelegate>

@end

@implementation WCNNavigationController

#pragma mark - Life Circle

+(void)load
{
    [[UINavigationBar appearance] setTintColor:[UIColor blackColor]];
}

- (instancetype)initWithRootViewController:(UIViewController *)rootViewController
{
    self = [super initWithRootViewController:rootViewController];
    if (self) {
        self.navigationBar.translucent = NO;
        self.navigationBar.barTintColor = [UIColor whiteColor];
        
        self.interactivePopGestureRecognizer.delegate = self;
    }
    return self;
}

#pragma mark - UIGestureRecognizerDelegate

- (BOOL)gestureRecognizerShouldBegin:(UIGestureRecognizer *)gestureRecognizer
{
    if (self.viewControllers.count == 1) {
        return NO;
    } else {
        return YES;
    }
}

- (UIViewController *)childViewControllerForStatusBarStyle{
    WCNTabBarVC *mainvc =self.topViewController;
    return mainvc.viewControllers[0];
}


//- (BOOL)shouldAutorotate
//{
//        if ([self.topViewController isKindOfClass:[WCNCreateMeetingVC class]]) { // 如果是这个 vc 则支持自动旋转
//            return YES;
//        }
//        return NO;
//}
//
//- (NSUInteger)supportedInterfaceOrientations
//{
//    if ([self.topViewController isKindOfClass:[WCNHospitalListVC class]]) { // 如果是这个 vc 则支持自动旋转
//        return UIInterfaceOrientationMaskPortrait;
//    }
//
//    return UIInterfaceOrientationMaskAllButUpsideDown;
//}
//
//-(UIInterfaceOrientation)preferredInterfaceOrientationForPresentation {
//    return UIInterfaceOrientationPortrait;
//}
@end
